<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>Object.freeze(obj)函数对对象的冻结</title>
	</head>
	<body>
		<script type="text/javascript">
			var num = 4;
			var numobj = new Number(6);
			var obj = {name:"lin",age:12};
			var obj2 = {name:"lin2",age:122};
			Object.freeze(num);
			Object.freeze(numobj);
			Object.freeze(obj);
			num = 8;
			numobj = 3;
			obj.name = "wang";
			console.log(num);// => 8
			console.log(numobj);// => 3
			console.log(obj.name);// => lin
			//即该方法仅对Object对象生效
			
			console.log(num instanceof Object);// => false
			
			delete obj.name;//name无法被删除
			delete obj2.name;//name可以被删除
			console.log(obj);// => {name:"lin",age:12}
			console.log(obj2);// => {name:"lin",age:122}
			
		</script>
	</body>
</html>

